home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / etc / cron.daily / beagle-crawl-system < prev    next >
Encoding:
Text File  |  2007-04-12  |  2.8 KB  |  89 lines

  1. #!/bin/bash
  2. set -e
  3.  
  4. #
  5. # beagle-crawl-system
  6. #
  7. # Copyright (C) 2005 Novell, Inc.
  8. #
  9.  
  10. #
  11. # Permission is hereby granted, free of charge, to any person obtaining a copy
  12. # of this software and associated documentation files (the "Software"), to deal
  13. # in the Software without restriction, including without limitation the rights
  14. # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  15. # copies of the Software, and to permit persons to whom the Software is
  16. # furnished to do so, subject to the following conditions:
  17. #
  18. # The above copyright notice and this permission notice shall be included in all
  19. # copies or substantial portions of the Software.
  20. #
  21. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  22. # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  23. # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  24. # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  25. # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  26. # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  27. # SOFTWARE.
  28. #
  29.  
  30. if [ ! -x /usr/sbin/beagle-build-index ] ; then
  31.     exit 0
  32. fi
  33.  
  34. umask 022
  35.  
  36. CRAWL_USER=beagleindex
  37.  
  38. export TMPDIR=/tmp
  39.  
  40. # Mono requires a writable wapi directory
  41. MONO_SHARED_DIR=`mktemp -d -p $TMPDIR .beagleindexwapi.XXXXXXXXXX`|| ( echo "Can't create wapi directory!" ; exit 1 )
  42. chown $CRAWL_USER $MONO_SHARED_DIR
  43.  
  44. for crawl_file in /etc/beagle/crawl-*; do 
  45.     unset CRAWL_ENABLED CRAWL_DISABLE_FILTERING CRAWL_RECURSIVE CRAWL_CACHE_TEXT CRAWL_ALLOW_PATTERNS CRAWL_DENY_PATTERNS CRAWL_PATHS CRAWL_INDEX_NAME OPTIONS
  46.  
  47.     if [ -f $crawl_file ] ; then
  48.     . $crawl_file
  49.  
  50.     if [ "$CRAWL_ENABLED" = "yes" ]; then
  51.  
  52.         if [ "$CRAWL_DISABLE_FILTERING" = "yes" ] ; then
  53.             OPTIONS="$OPTIONS --disable-filtering"
  54.         fi
  55.  
  56.         if [ "$CRAWL_DISABLE_DIRECTORIES" = "yes" ] ; then
  57.             OPTIONS="$OPTIONS --disable-directories"
  58.         fi
  59.  
  60.         if [ "$CRAWL_RECURSIVE" = "yes" ] ; then
  61.             OPTIONS="$OPTIONS --recursive"
  62.         fi
  63.  
  64.         if [ "$CRAWL_CACHE_TEXT" = "yes" ] ; then
  65.             OPTIONS="$OPTIONS --enable-text-cache"
  66.         fi
  67.  
  68.         if [ -n "$CRAWL_ALLOW_PATTERNS" ] ; then
  69.             OPTIONS="$OPTIONS --allow-pattern $CRAWL_ALLOW_PATTERNS"
  70.         fi
  71.  
  72.         if [ -n "$CRAWL_DENY_PATTERNS" ] ; then
  73.             OPTIONS="$OPTIONS --deny-pattern $CRAWL_DENY_PATTERNS"
  74.         fi
  75.  
  76.         if IONICE=`which ionice 2>/dev/null`; then
  77.             IONICE="$IONICE -c 3"
  78.         fi
  79.     
  80.         eval $IONICE su -s /bin/bash $CRAWL_USER -c \"MONO_SHARED_DIR=$MONO_SHARED_DIR /usr/sbin/beagle-build-index --target /var/cache/beagle/indexes/$CRAWL_INDEX_NAME $OPTIONS $CRAWL_PATHS\" > /dev/null 2>&1
  81.     fi
  82.     fi
  83. done
  84.  
  85. # delete wapi directory
  86. rm -rf $MONO_SHARED_DIR
  87.  
  88. exit 0
  89.